# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BigQuery.V2.Model.TrainingOptions do
  @moduledoc """
  Options used in model training.

  ## Attributes

  *   `l1Regularization` (*type:* `float()`, *default:* `nil`) - L1 regularization coefficient.
  *   `distanceType` (*type:* `String.t`, *default:* `nil`) - Distance type for clustering models.
  *   `dataSplitColumn` (*type:* `String.t`, *default:* `nil`) - The column to split data with. This column won't be used as a feature. 1. When data_split_method is CUSTOM, the corresponding column should be boolean. The rows with true value tag are eval data, and the false are training data. 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION rows (from smallest to largest) in the corresponding column are used as training data, and the rest are eval data. It respects the order in Orderable data types: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data_type_properties
  *   `holidayRegion` (*type:* `String.t`, *default:* `nil`) - The geographical region based on which the holidays are considered in time series modeling. If a valid value is specified, then holiday effects modeling is enabled.
  *   `inputLabelColumns` (*type:* `list(String.t)`, *default:* `nil`) - Name of input label columns in training data.
  *   `trendSmoothingWindowSize` (*type:* `String.t`, *default:* `nil`) - Smoothing window size for the trend component. When a positive value is specified, a center moving average smoothing is applied on the history trend. When the smoothing window is out of the boundary at the beginning or the end of the trend, the first element or the last element is padded to fill the smoothing window before the average is applied.
  *   `autoArimaMaxOrder` (*type:* `String.t`, *default:* `nil`) - The max value of the sum of non-seasonal p and q.
  *   `numPrincipalComponents` (*type:* `String.t`, *default:* `nil`) - Number of principal components to keep in the PCA model. Must be <= the number of features.
  *   `hiddenUnits` (*type:* `list(String.t)`, *default:* `nil`) - Hidden units for dnn models.
  *   `lossType` (*type:* `String.t`, *default:* `nil`) - Type of loss function used during training run.
  *   `colsampleBytree` (*type:* `float()`, *default:* `nil`) - Subsample ratio of columns when constructing each tree for boosted tree models.
  *   `numFactors` (*type:* `String.t`, *default:* `nil`) - Num factors specified for matrix factorization models.
  *   `autoArimaMinOrder` (*type:* `String.t`, *default:* `nil`) - The min value of the sum of non-seasonal p and q.
  *   `horizon` (*type:* `String.t`, *default:* `nil`) - The number of periods ahead that need to be forecasted.
  *   `nonSeasonalOrder` (*type:* `GoogleApi.BigQuery.V2.Model.ArimaOrder.t`, *default:* `nil`) - A specification of the non-seasonal part of the ARIMA model: the three components (p, d, q) are the AR order, the degree of differencing, and the MA order.
  *   `fitIntercept` (*type:* `boolean()`, *default:* `nil`) - Whether the model should include intercept during model training.
  *   `pcaExplainedVarianceRatio` (*type:* `float()`, *default:* `nil`) - The minimum ratio of cumulative explained variance that needs to be given by the PCA model.
  *   `autoArima` (*type:* `boolean()`, *default:* `nil`) - Whether to enable auto ARIMA or not.
  *   `categoryEncodingMethod` (*type:* `String.t`, *default:* `nil`) - Categorical feature encoding method.
  *   `decomposeTimeSeries` (*type:* `boolean()`, *default:* `nil`) - If true, perform decompose time series and save the results.
  *   `minTreeChildWeight` (*type:* `String.t`, *default:* `nil`) - Minimum sum of instance weight needed in a child for boosted tree models.
  *   `maxTreeDepth` (*type:* `String.t`, *default:* `nil`) - Maximum depth of a tree for boosted tree models.
  *   `timeSeriesIdColumn` (*type:* `String.t`, *default:* `nil`) - The time series id column that was used during ARIMA model training.
  *   `warmStart` (*type:* `boolean()`, *default:* `nil`) - Whether to train a model from the last checkpoint.
  *   `isTestColumn` (*type:* `String.t`, *default:* `nil`) - Name of the column used to determine the rows corresponding to control and test. Applies to contribution analysis models.
  *   `batchSize` (*type:* `String.t`, *default:* `nil`) - Batch size for dnn models.
  *   `dataSplitMethod` (*type:* `String.t`, *default:* `nil`) - The data split type for training and evaluation, e.g. RANDOM.
  *   `earlyStop` (*type:* `boolean()`, *default:* `nil`) - Whether to stop early when the loss doesn't improve significantly any more (compared to min_relative_progress). Used only for iterative training algorithms.
  *   `includeDrift` (*type:* `boolean()`, *default:* `nil`) - Include drift when fitting an ARIMA model.
  *   `forecastLimitUpperBound` (*type:* `float()`, *default:* `nil`) - The forecast limit upper bound that was used during ARIMA model training with limits.
  *   `calculatePValues` (*type:* `boolean()`, *default:* `nil`) - Whether or not p-value test should be computed for this model. Only available for linear and logistic regression models.
  *   `timeSeriesDataColumn` (*type:* `String.t`, *default:* `nil`) - Column to be designated as time series data for ARIMA model.
  *   `enableGlobalExplain` (*type:* `boolean()`, *default:* `nil`) - If true, enable global explanation during training.
  *   `learnRateStrategy` (*type:* `String.t`, *default:* `nil`) - The strategy to determine learn rate for the current iteration.
  *   `xgboostVersion` (*type:* `String.t`, *default:* `nil`) - User-selected XGBoost versions for training of XGBoost models.
  *   `cleanSpikesAndDips` (*type:* `boolean()`, *default:* `nil`) - If true, clean spikes and dips in the input time series.
  *   `integratedGradientsNumSteps` (*type:* `String.t`, *default:* `nil`) - Number of integral steps for the integrated gradients explain method.
  *   `treeMethod` (*type:* `String.t`, *default:* `nil`) - Tree construction algorithm for boosted tree models.
  *   `pcaSolver` (*type:* `String.t`, *default:* `nil`) - The solver for PCA.
  *   `holidayRegions` (*type:* `list(String.t)`, *default:* `nil`) - A list of geographical regions that are used for time series modeling.
  *   `numTrials` (*type:* `String.t`, *default:* `nil`) - Number of trials to run this hyperparameter tuning job.
  *   `budgetHours` (*type:* `float()`, *default:* `nil`) - Budget in hours for AutoML training.
  *   `maxParallelTrials` (*type:* `String.t`, *default:* `nil`) - Maximum number of trials to run in parallel.
  *   `dartNormalizeType` (*type:* `String.t`, *default:* `nil`) - Type of normalization algorithm for boosted tree models using dart booster.
  *   `feedbackType` (*type:* `String.t`, *default:* `nil`) - Feedback type that specifies which algorithm to run for matrix factorization.
  *   `forecastLimitLowerBound` (*type:* `float()`, *default:* `nil`) - The forecast limit lower bound that was used during ARIMA model training with limits. To see more details of the algorithm: https://otexts.com/fpp2/limits.html
  *   `boosterType` (*type:* `String.t`, *default:* `nil`) - Booster type for boosted tree models.
  *   `minRelativeProgress` (*type:* `float()`, *default:* `nil`) - When early_stop is true, stops training when accuracy improvement is less than 'min_relative_progress'. Used only for iterative training algorithms.
  *   `subsample` (*type:* `float()`, *default:* `nil`) - Subsample fraction of the training data to grow tree to prevent overfitting for boosted tree models.
  *   `labelClassWeights` (*type:* `map()`, *default:* `nil`) - Weights associated with each label class, for rebalancing the training data. Only applicable for classification models.
  *   `l1RegActivation` (*type:* `float()`, *default:* `nil`) - L1 regularization coefficient to activations.
  *   `itemColumn` (*type:* `String.t`, *default:* `nil`) - Item column specified for matrix factorization models.
  *   `dimensionIdColumns` (*type:* `list(String.t)`, *default:* `nil`) - Optional. Names of the columns to slice on. Applies to contribution analysis models.
  *   `kmeansInitializationMethod` (*type:* `String.t`, *default:* `nil`) - The method used to initialize the centroids for kmeans algorithm.
  *   `minTimeSeriesLength` (*type:* `String.t`, *default:* `nil`) - The minimum number of time points in a time series that are used in modeling the trend component of the time series. If you use this option you must also set the `timeSeriesLengthFraction` option. This training option ensures that enough time points are available when you use `timeSeriesLengthFraction` in trend modeling. This is particularly important when forecasting multiple time series in a single query using `timeSeriesIdColumn`. If the total number of time points is less than the `minTimeSeriesLength` value, then the query uses all available time points.
  *   `kmeansInitializationColumn` (*type:* `String.t`, *default:* `nil`) - The column used to provide the initial centroids for kmeans algorithm when kmeans_initialization_method is CUSTOM.
  *   `colsampleBylevel` (*type:* `float()`, *default:* `nil`) - Subsample ratio of columns for each level for boosted tree models.
  *   `scaleFeatures` (*type:* `boolean()`, *default:* `nil`) - If true, scale the feature values by dividing the feature standard deviation. Currently only apply to PCA.
  *   `standardizeFeatures` (*type:* `boolean()`, *default:* `nil`) - Whether to standardize numerical features. Default to true.
  *   `timeSeriesTimestampColumn` (*type:* `String.t`, *default:* `nil`) - Column to be designated as time series timestamp for ARIMA model.
  *   `instanceWeightColumn` (*type:* `String.t`, *default:* `nil`) - Name of the instance weight column for training data. This column isn't be used as a feature.
  *   `dropout` (*type:* `float()`, *default:* `nil`) - Dropout probability for dnn models.
  *   `l2Regularization` (*type:* `float()`, *default:* `nil`) - L2 regularization coefficient.
  *   `autoClassWeights` (*type:* `boolean()`, *default:* `nil`) - Whether to calculate class weights automatically based on the popularity of each label.
  *   `optimizer` (*type:* `String.t`, *default:* `nil`) - Optimizer used for training the neural nets.
  *   `colsampleBynode` (*type:* `float()`, *default:* `nil`) - Subsample ratio of columns for each node(split) for boosted tree models.
  *   `contributionMetric` (*type:* `String.t`, *default:* `nil`) - The contribution metric. Applies to contribution analysis models. Allowed formats supported are for summable and summable ratio contribution metrics. These include expressions such as `SUM(x)` or `SUM(x)/SUM(y)`, where x and y are column names from the base table.
  *   `modelUri` (*type:* `String.t`, *default:* `nil`) - Google Cloud Storage URI from which the model was imported. Only applicable for imported models.
  *   `sampledShapleyNumPaths` (*type:* `String.t`, *default:* `nil`) - Number of paths for the sampled Shapley explain method.
  *   `initialLearnRate` (*type:* `float()`, *default:* `nil`) - Specifies the initial learning rate for the line search learn rate strategy.
  *   `modelRegistry` (*type:* `String.t`, *default:* `nil`) - The model registry.
  *   `timeSeriesIdColumns` (*type:* `list(String.t)`, *default:* `nil`) - The time series id columns that were used during ARIMA model training.
  *   `learnRate` (*type:* `float()`, *default:* `nil`) - Learning rate in training. Used only for iterative training algorithms.
  *   `minAprioriSupport` (*type:* `float()`, *default:* `nil`) - The apriori support minimum. Applies to contribution analysis models.
  *   `dataSplitEvalFraction` (*type:* `float()`, *default:* `nil`) - The fraction of evaluation data over the whole input data. The rest of data will be used as training data. The format should be double. Accurate to two decimal places. Default value is 0.2.
  *   `tfVersion` (*type:* `String.t`, *default:* `nil`) - Based on the selected TF version, the corresponding docker image is used to train external models.
  *   `optimizationStrategy` (*type:* `String.t`, *default:* `nil`) - Optimization strategy for training linear regression models.
  *   `maxTimeSeriesLength` (*type:* `String.t`, *default:* `nil`) - The maximum number of time points in a time series that can be used in modeling the trend component of the time series. Don't use this option with the `timeSeriesLengthFraction` or `minTimeSeriesLength` options.
  *   `vertexAiModelVersionAliases` (*type:* `list(String.t)`, *default:* `nil`) - The version aliases to apply in Vertex AI model registry. Always overwrite if the version aliases exists in a existing model.
  *   `dataFrequency` (*type:* `String.t`, *default:* `nil`) - The data frequency of a time series.
  *   `minSplitLoss` (*type:* `float()`, *default:* `nil`) - Minimum split loss for boosted tree models.
  *   `approxGlobalFeatureContrib` (*type:* `boolean()`, *default:* `nil`) - Whether to use approximate feature contribution method in XGBoost model explanation for global explain.
  *   `hparamTuningObjectives` (*type:* `list(String.t)`, *default:* `nil`) - The target evaluation metrics to optimize the hyperparameters for.
  *   `colorSpace` (*type:* `String.t`, *default:* `nil`) - Enums for color space, used for processing images in Object Table. See more details at https://www.tensorflow.org/io/tutorials/colorspace.
  *   `walsAlpha` (*type:* `float()`, *default:* `nil`) - Hyperparameter for matrix factoration when implicit feedback type is specified.
  *   `userColumn` (*type:* `String.t`, *default:* `nil`) - User column specified for matrix factorization models.
  *   `timeSeriesLengthFraction` (*type:* `float()`, *default:* `nil`) - The fraction of the interpolated length of the time series that's used to model the time series trend component. All of the time points of the time series are used to model the non-trend component. This training option accelerates modeling training without sacrificing much forecasting accuracy. You can use this option with `minTimeSeriesLength` but not with `maxTimeSeriesLength`.
  *   `numParallelTree` (*type:* `String.t`, *default:* `nil`) - Number of parallel trees constructed during each iteration for boosted tree models.
  *   `maxIterations` (*type:* `String.t`, *default:* `nil`) - The maximum number of iterations in training. Used only for iterative training algorithms.
  *   `activationFn` (*type:* `String.t`, *default:* `nil`) - Activation function of the neural nets.
  *   `adjustStepChanges` (*type:* `boolean()`, *default:* `nil`) - If true, detect step changes and make data adjustment in the input time series.
  *   `numClusters` (*type:* `String.t`, *default:* `nil`) - Number of clusters for clustering models.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :l1Regularization => float() | nil,
          :distanceType => String.t() | nil,
          :dataSplitColumn => String.t() | nil,
          :holidayRegion => String.t() | nil,
          :inputLabelColumns => list(String.t()) | nil,
          :trendSmoothingWindowSize => String.t() | nil,
          :autoArimaMaxOrder => String.t() | nil,
          :numPrincipalComponents => String.t() | nil,
          :hiddenUnits => list(String.t()) | nil,
          :lossType => String.t() | nil,
          :colsampleBytree => float() | nil,
          :numFactors => String.t() | nil,
          :autoArimaMinOrder => String.t() | nil,
          :horizon => String.t() | nil,
          :nonSeasonalOrder => GoogleApi.BigQuery.V2.Model.ArimaOrder.t() | nil,
          :fitIntercept => boolean() | nil,
          :pcaExplainedVarianceRatio => float() | nil,
          :autoArima => boolean() | nil,
          :categoryEncodingMethod => String.t() | nil,
          :decomposeTimeSeries => boolean() | nil,
          :minTreeChildWeight => String.t() | nil,
          :maxTreeDepth => String.t() | nil,
          :timeSeriesIdColumn => String.t() | nil,
          :warmStart => boolean() | nil,
          :isTestColumn => String.t() | nil,
          :batchSize => String.t() | nil,
          :dataSplitMethod => String.t() | nil,
          :earlyStop => boolean() | nil,
          :includeDrift => boolean() | nil,
          :forecastLimitUpperBound => float() | nil,
          :calculatePValues => boolean() | nil,
          :timeSeriesDataColumn => String.t() | nil,
          :enableGlobalExplain => boolean() | nil,
          :learnRateStrategy => String.t() | nil,
          :xgboostVersion => String.t() | nil,
          :cleanSpikesAndDips => boolean() | nil,
          :integratedGradientsNumSteps => String.t() | nil,
          :treeMethod => String.t() | nil,
          :pcaSolver => String.t() | nil,
          :holidayRegions => list(String.t()) | nil,
          :numTrials => String.t() | nil,
          :budgetHours => float() | nil,
          :maxParallelTrials => String.t() | nil,
          :dartNormalizeType => String.t() | nil,
          :feedbackType => String.t() | nil,
          :forecastLimitLowerBound => float() | nil,
          :boosterType => String.t() | nil,
          :minRelativeProgress => float() | nil,
          :subsample => float() | nil,
          :labelClassWeights => map() | nil,
          :l1RegActivation => float() | nil,
          :itemColumn => String.t() | nil,
          :dimensionIdColumns => list(String.t()) | nil,
          :kmeansInitializationMethod => String.t() | nil,
          :minTimeSeriesLength => String.t() | nil,
          :kmeansInitializationColumn => String.t() | nil,
          :colsampleBylevel => float() | nil,
          :scaleFeatures => boolean() | nil,
          :standardizeFeatures => boolean() | nil,
          :timeSeriesTimestampColumn => String.t() | nil,
          :instanceWeightColumn => String.t() | nil,
          :dropout => float() | nil,
          :l2Regularization => float() | nil,
          :autoClassWeights => boolean() | nil,
          :optimizer => String.t() | nil,
          :colsampleBynode => float() | nil,
          :contributionMetric => String.t() | nil,
          :modelUri => String.t() | nil,
          :sampledShapleyNumPaths => String.t() | nil,
          :initialLearnRate => float() | nil,
          :modelRegistry => String.t() | nil,
          :timeSeriesIdColumns => list(String.t()) | nil,
          :learnRate => float() | nil,
          :minAprioriSupport => float() | nil,
          :dataSplitEvalFraction => float() | nil,
          :tfVersion => String.t() | nil,
          :optimizationStrategy => String.t() | nil,
          :maxTimeSeriesLength => String.t() | nil,
          :vertexAiModelVersionAliases => list(String.t()) | nil,
          :dataFrequency => String.t() | nil,
          :minSplitLoss => float() | nil,
          :approxGlobalFeatureContrib => boolean() | nil,
          :hparamTuningObjectives => list(String.t()) | nil,
          :colorSpace => String.t() | nil,
          :walsAlpha => float() | nil,
          :userColumn => String.t() | nil,
          :timeSeriesLengthFraction => float() | nil,
          :numParallelTree => String.t() | nil,
          :maxIterations => String.t() | nil,
          :activationFn => String.t() | nil,
          :adjustStepChanges => boolean() | nil,
          :numClusters => String.t() | nil
        }

  field(:l1Regularization)
  field(:distanceType)
  field(:dataSplitColumn)
  field(:holidayRegion)
  field(:inputLabelColumns, type: :list)
  field(:trendSmoothingWindowSize)
  field(:autoArimaMaxOrder)
  field(:numPrincipalComponents)
  field(:hiddenUnits, type: :list)
  field(:lossType)
  field(:colsampleBytree)
  field(:numFactors)
  field(:autoArimaMinOrder)
  field(:horizon)
  field(:nonSeasonalOrder, as: GoogleApi.BigQuery.V2.Model.ArimaOrder)
  field(:fitIntercept)
  field(:pcaExplainedVarianceRatio)
  field(:autoArima)
  field(:categoryEncodingMethod)
  field(:decomposeTimeSeries)
  field(:minTreeChildWeight)
  field(:maxTreeDepth)
  field(:timeSeriesIdColumn)
  field(:warmStart)
  field(:isTestColumn)
  field(:batchSize)
  field(:dataSplitMethod)
  field(:earlyStop)
  field(:includeDrift)
  field(:forecastLimitUpperBound)
  field(:calculatePValues)
  field(:timeSeriesDataColumn)
  field(:enableGlobalExplain)
  field(:learnRateStrategy)
  field(:xgboostVersion)
  field(:cleanSpikesAndDips)
  field(:integratedGradientsNumSteps)
  field(:treeMethod)
  field(:pcaSolver)
  field(:holidayRegions, type: :list)
  field(:numTrials)
  field(:budgetHours)
  field(:maxParallelTrials)
  field(:dartNormalizeType)
  field(:feedbackType)
  field(:forecastLimitLowerBound)
  field(:boosterType)
  field(:minRelativeProgress)
  field(:subsample)
  field(:labelClassWeights, type: :map)
  field(:l1RegActivation)
  field(:itemColumn)
  field(:dimensionIdColumns, type: :list)
  field(:kmeansInitializationMethod)
  field(:minTimeSeriesLength)
  field(:kmeansInitializationColumn)
  field(:colsampleBylevel)
  field(:scaleFeatures)
  field(:standardizeFeatures)
  field(:timeSeriesTimestampColumn)
  field(:instanceWeightColumn)
  field(:dropout)
  field(:l2Regularization)
  field(:autoClassWeights)
  field(:optimizer)
  field(:colsampleBynode)
  field(:contributionMetric)
  field(:modelUri)
  field(:sampledShapleyNumPaths)
  field(:initialLearnRate)
  field(:modelRegistry)
  field(:timeSeriesIdColumns, type: :list)
  field(:learnRate)
  field(:minAprioriSupport)
  field(:dataSplitEvalFraction)
  field(:tfVersion)
  field(:optimizationStrategy)
  field(:maxTimeSeriesLength)
  field(:vertexAiModelVersionAliases, type: :list)
  field(:dataFrequency)
  field(:minSplitLoss)
  field(:approxGlobalFeatureContrib)
  field(:hparamTuningObjectives, type: :list)
  field(:colorSpace)
  field(:walsAlpha)
  field(:userColumn)
  field(:timeSeriesLengthFraction)
  field(:numParallelTree)
  field(:maxIterations)
  field(:activationFn)
  field(:adjustStepChanges)
  field(:numClusters)
end

defimpl Poison.Decoder, for: GoogleApi.BigQuery.V2.Model.TrainingOptions do
  def decode(value, options) do
    GoogleApi.BigQuery.V2.Model.TrainingOptions.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BigQuery.V2.Model.TrainingOptions do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
